home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gtlayout.lha
/
Source
/
gtlayout_internal.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-09-09
|
23KB
|
1,077 lines
/*
** GadTools layout toolkit
**
** Copyright © 1993-1998 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=8
*/
#ifndef _GTLAYOUT_INTERNAL_H
#define _GTLAYOUT_INTERNAL_H 1
// Debugging stuff
#ifdef DEBUG
#define DB(x) x
#else
#define DB(x) ;
#endif /* DEBUG */
// Keep this one handy
VOID kprintf(STRPTR,...);
/*****************************************************************************/
// Keyboard qualifiers
#define QUALIFIER_SHIFT (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
#define QUALIFIER_ALT (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
#define QUALIFIER_CONTROL (IEQUALIFIER_CONTROL)
/*****************************************************************************/
// Undefine these to remove various chunks of support from this code
#ifdef _GTLAYOUT_GLOBAL_H
#define DO_PASSWORD_KIND
#define DO_GAUGE_KIND
#define DO_TAPEDECK_KIND
#define DO_HEXHOOK
#define DO_PICKSHORTCUTS
#define DO_CLONING
#define DO_LEVEL_KIND
#define DO_BOOPSI_KIND
#define DO_MENUS
#define DO_POPUP_KIND
#define DO_TAB_KIND
#else
#define DO_PASSWORD_KIND
#define DO_GAUGE_KIND
#define DO_CLONING
#define DO_BOOPSI_KIND
#define DO_POPUP_KIND
#endif // _GTLAYOUT_GLOBAL_H
// These types require that the BOOPSI_KIND support
// code is included.
#if defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND)
#define DO_BOOPSI_KIND
#endif /* defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND) */
/*****************************************************************************/
APTR ASM AsmCreatePool(REG(d0) ULONG MemFlags,REG(d1) ULONG PuddleSize,REG(d2) ULONG ThreshSize,REG(a6) struct Library *SysBase);
VOID ASM AsmDeletePool(REG(a0) APTR PoolHeader,REG(a6) struct Library *SysBase);
APTR ASM AsmAllocPooled(REG(a0) APTR PoolHeader,REG(d0) ULONG Size,REG(a6) struct Library *SysBase);
VOID ASM AsmFreePooled(REG(a0) APTR PoolHeader,REG(a1) APTR Memory,REG(d0) ULONG MemSize,REG(a6) struct Library *SysBase);
/*****************************************************************************/
// Scan an Exec list
#define SCANLIST(l,n) for(n = (APTR)((struct MinList *)l)->mlh_Head; \
((struct MinNode *)n)->mln_Succ; \
n = (APTR)((struct MinNode *)n)->mln_Succ)
// Scan the objects of a group
#define SCANGROUP(g,n) for(n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
((struct MinNode *)n)->mln_Succ; \
n = (APTR)((struct MinNode *)n)->mln_Succ)
// Scan the objects of a group, only allowing active pages
#define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
((struct MinNode *)n)->mln_Succ; \
n = (APTR)((struct MinNode *)n)->mln_Succ) \
if ((p++ == g->Special . Group . ActivePage) || !g->Special . Group . Paging)
// Get an object pointer from a gadget pointer
#define GETOBJECT(g,n) ((n = (ObjectNode *)g->UserData) && (n->Host == g) && (n->PointBack == n))
/*****************************************************************************/
#ifdef DO_PASSWORD_KIND
#define TEST_PASSWORD_KIND(n) (n->Type == PASSWORD_KIND)
#else
#define TEST_PASSWORD_KIND(n) (FALSE)
#endif /* DO_PASSWORD_KIND */
// Is an object derived from STRING_KIND?
#define LIKE_STRING_KIND(n) (n->Type == STRING_KIND || n->Type == FRACTION_KIND || TEST_PASSWORD_KIND(n))
/*****************************************************************************/
#define NUMELEMENTS(s) (sizeof(s) / sizeof((s)[0]))
#define NOT !
#define CANNOT !
/*****************************************************************************/
typedef char BOOLEAN;
/*****************************************************************************/
#define INCREMENTER_KIND 42
#define PICKER_KIND 43
#define GROUP_KIND 44
#define LAPR_Gadget TAG_USER+100
#define LAPR_Object TAG_USER+101
typedef struct GaugeExtra
{
LONG InfoLength;
STRPTR InfoText;
WORD LastPercentage;
BOOLEAN NoTicks;
BOOLEAN Discrete;
} GaugeExtra;
typedef struct TapeDeckExtra
{
struct Image * ButtonImage;
LONG ButtonWidth,
ButtonHeight;
BOOLEAN ButtonType;
BOOLEAN Toggle;
BOOLEAN Smaller;
BOOLEAN Tick;
} TapeDeckExtra;
typedef struct ButtonExtra
{
struct Image * ButtonImage;
STRPTR KeyStroke;
STRPTR * Lines;
UBYTE LineCount;
BOOLEAN ReturnKey;
BOOLEAN EscKey;
BOOLEAN ExtraFat;
BOOLEAN DefaultCorrection;
BOOLEAN Smaller;
} ButtonExtra;
typedef struct BarExtra
{
struct ObjectNode * Parent;
BOOLEAN FullSize;
} BarExtra;
typedef struct BoxExtra
{
struct ObjectNode * Parent;
STRPTR * Labels;
STRPTR * Lines;
UWORD Spacing;
WORD MaxSize;
WORD TextPen;
WORD BackPen;
BYTE AlignText;
BOOLEAN DrawBox;
BOOLEAN ReserveSpace;
} BoxExtra;
typedef struct FrameExtra
{
struct Hook * RefreshHook;
UWORD InnerWidth;
UWORD InnerHeight;
struct Gadget Dummy;
WORD PlusWidth; // Is used by the resizing process
WORD PlusHeight; // to change the inner width
BOOLEAN DrawBox;
BOOLEAN GenerateEvents;
BOOLEAN ResizeX;
BOOLEAN ResizeY;
} FrameExtra;
typedef struct PickerExtra
{
struct Gadget * Parent; // Important: must match IncrementerExtra!
struct Image * Image; // Important: must match IncrementerExtra!
} PickerExtra;
typedef struct IncrementerExtra
{
struct Gadget * Parent; // Important: must match PickerExtra!
struct Image * Image; // Important: must match PickerExtra!
LONG Amount;
} IncrementerExtra;
typedef struct GroupExtra
{
struct MinList ObjectList;
struct ObjectNode * ParentGroup;
LONG MaxOffset;
LONG MaxSize;
ULONG ActivePage;
UWORD ExtraLeft;
UWORD ExtraTop;
UWORD FrameType;
UBYTE MiscFlags;
BOOLEAN Horizontal;
BOOLEAN Paging;
BOOLEAN Spread;
BOOLEAN SameSize;
BOOLEAN LastAttributes;
BOOLEAN Visible;
BOOLEAN Frame;
BOOLEAN IndentX;
BOOLEAN IndentY;
BOOLEAN NoIndent;
BOOLEAN AlignRight;
} GroupExtra;
#define GROUPF_WidthDone (1<<0)
#define GROUPF_HeightDone (1<<1)
typedef struct ListExtra
{
struct List * Labels;
struct Gadget * Link;
LONG LinkID;
struct Hook * CallBack;
LONG AutoPageID;
struct TextAttr * TextAttr;
STRPTR * ExtraLabels;
UWORD ExtraLabelWidth;
UWORD MaxPen;
UWORD MaxGrowX,MaxGrowY;
UWORD MinChars,MinLines;
WORD FixedGlyphWidth;
WORD FixedGlyphHeight;
BOOLEAN ReadOnly;
BOOLEAN CursorKey;
BOOLEAN AllocatedList;
BOOLEAN LockSize;
BOOLEAN SizeLocked;
BOOLEAN ResizeX;
BOOLEAN ResizeY;
BOOLEAN FlushLabelLeft;
BOOLEAN IgnoreListContents;
BOOLEAN AdjustForString;
} ListExtra;
typedef struct RadioExtra
{
STRPTR * Choices;
LONG AutoPageID;
UWORD LabelWidth;
UBYTE TitlePlace;
BOOLEAN TabKey;
} RadioExtra;
typedef struct TextExtra
{
STRPTR Text;
struct Gadget * Picker;
WORD FrontPen;
WORD BackPen;
UWORD Len;
UBYTE Justification;
BOOLEAN Border;
BOOLEAN CopyText;
BOOLEAN UsePicker;
BOOLEAN LockSize;
BOOLEAN SizeLocked;
} TextExtra;
typedef struct NumberExtra
{
LONG Number;
STRPTR Format;
WORD FrontPen;
WORD BackPen;
WORD MaxNumberLen;
UBYTE Justification;
BOOLEAN Border;
} NumberExtra;
typedef struct CycleExtra
{
STRPTR * Choices;
LONG AutoPageID;
BOOLEAN TabKey;
} CycleExtra;
typedef struct PalExtra
{
UBYTE * ColourTable;
UBYTE * TranslateBack;
struct Gadget * Picker;
UWORD Depth;
UWORD NumColours;
UWORD IndicatorWidth;
BOOLEAN SmallPalette;
BOOLEAN UsePicker;
} PalExtra;
typedef struct SliderExtra
{
STRPTR LevelFormat;
DISPFUNC DispFunc;
LONG MaxLevelLen;
LONG LevelWidth;
STRPTR OriginalLabel;
UBYTE LevelPlace;
BOOLEAN FullLevelCheck;
} SliderExtra;
typedef struct StringExtra
{
struct LayoutHandle * LayoutHandle;
struct Hook * HistoryHook;
ULONG MaxHistoryLines;
ULONG NumHistoryLines;
struct Node * CurrentNode;
STRPTR String;
LONG MaxChars;
struct Hook * EditHook;
struct Hook * ValidateHook;
struct Gadget * Picker;
STRPTR Backup;
STRPTR RealString;
STRPTR Original;
LONG LinkID;
struct Gadget * LeftIncrementer;
struct Gadget * RightIncrementer;
struct Hook * IncrementerHook;
UBYTE Justification;
BOOLEAN LastGadget;
BOOLEAN